/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.general.bc.AreaFacadeLocal;
import org.cip.esymons.general.be.Area;

/**
 *
 * @author ADMINISTRADOR
 */
public class AreaDelegate {
    
    
    private AreaFacadeLocal local;

    public AreaDelegate() {
    
        local = lookupAreaFacade();
    }
    
    public void create(Area area){
        
        local.create(area);
    }

    public void edit(Area area){
        local.edit(area);
    }

    public void remove(Area area){
        local.remove(area);
    }

    public Area find(Object id){
        return local.find(id);
    }

    public List<Area> findAll(){
        return local.findAll();
    }

    public Area buscar(String nom){
        return local.buscar(nom);
    }

    private AreaFacadeLocal lookupAreaFacade() {
        try {
            Context c = new InitialContext();
            return (AreaFacadeLocal) c.lookup("java:comp/env/AreaFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }



}
